//
//  TipcellView.swift
//  旅航ios
//
//  Created by tulip on 2021/5/8.
//

import UIKit
import SwiftyJSON

class TipcellView: UIView {
    var tkData:JSON?
    var pgDic:Dictionary<String,Any>?
    var lab1:UILabel!
    var lab2:UILabel!
    override init(frame: CGRect) {  // height 60
        super.init(frame: frame)
        
        var line=UIView.init(frame: CGRect(x: 12, y: 9, width: 3, height: 42))
        
        line=gradientColor(colo1: "307cf8", colo2: "ffffff", view: line,width: 3)
        self.addSubview(line)
        
        lab1=UILabel.init(frame: CGRect(x: 27, y: 9, width: 200, height: 14))
        lab1.text="北京-杭州"
        lab1.textColor=UIColor.init(hexString: "333333")
        lab1.font=UIFont.systemFont(ofSize: 14)
        self.addSubview(lab1)
        
        lab2=UILabel.init(frame: CGRect(x: 27, y: 9+28, width: frame.size.width-27, height: 14))
        lab2.text="2021年04月20日 周二 19:00起飞"
        lab2.textColor=UIColor.init(hexString: "333333")
        lab2.font=UIFont.systemFont(ofSize: 14)
        self.addSubview(lab2)
        
      
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setText_json(){
        let dptCity=tkData?["dptCity"].string ?? ""
        let arrCity=tkData?["arrCity"].string ?? ""
        let dptDate=tkData?["dptDate"].string ?? ""
        let dptTime=tkData?["dptTime"].string ?? ""
        
        lab1.text=dptCity + "-" + arrCity
        lab2.text=dptDate + " " + dptTime + " 起飞"
      
    }
    func setText_Dic(){
        let name=pgDic?["name"] as? String
        let idNum=pgDic?["idNum"] as? String
        
        lab1.text="姓名  " + (name ?? "")
        lab2.text = "身份证  " + (idNum ?? "")
        
    }
}
